console.log(__dirname)

console.log(__filename)

console.error('错误信息')

console.log(process.cwd)

console.log(process.env.PATH)

console.log(process.pid)

console.log(process.argv)

const baseURL = new URL("https://example.com");
const myURL = new URL("/foo", baseURL);

myURL.searchParams.append("key", "value")
console.log(myURL.href)

let params = new URLSearchParams(myURL.searchParams)
params.append("key1", "value1")
params.append("key2", "李四")
console.log(params)
myURL.search = params
console.log(myURL.href)

//Buffer对象
const buf = Buffer.from("r中国", "utf-8")
const strBase64 = buf.toString("base64")
console.log(strBase64)
console.log(Buffer.from(strBase64, "base64").toString("utf-8"))

//定时器
let timer = setInterval(() => {
    console.log(`${new Date().toLocaleString()}`)
}, 1000)

process.on("SIGINT", () => {
    console.log("系统退出...")
    clearInterval(timer)
})

// process.exit(0)